     document.onkeydown = function(event) {
            var target, code, tag;
            if (!event) {
                event = window.event; //针对ie浏览器
                target = event.srcElement;
                code = event.keyCode;
                if (code == 13) {
                    tag = target.tagName;
                    if (tag == "TEXTAREA") { return true; }
                    else { return false; }
                }
            }
            else {
                target = event.target; //针对遵循w3c标准的浏览器，如Firefox
                code = event.keyCode;
                if (code == 13) {
                    tag = target.tagName;
                    if (tag == "INPUT") { return false; }
                    else { return true; }
                }
            }
        };
        
        //------- Start 判断输入的是否是证书和小数还有0
        
        function CupperCase(obj){//用户只能输入正负数与小数
         
            var resultValue = document.getElementById("A1PH_Level08");
 	        var pindex = resultValue.selectedIndex;
 	        var resulttxt = resultValue.options[pindex].text;
 	        var inum;
 	        var newValue;
 	        if(resulttxt=="0.01"){inum=1;}else{inum=2;}
 	        
 	        if(inum==1)
 	        {
         
	            if(isNaN(obj.value) && !/^-$/.test(obj.value)){
		            obj.value="";
	            }
	            if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
		            obj.value=obj.value.replace(/\.\d{1,}$/,obj.value.substr(obj.value.indexOf('.'),inum));
		            obj.value=newValue.replace('.','');
	            }
	        }
	        else
	        {
	        
	            if(isNaN(obj.value) && !/^-$/.test(obj.value)){
	                obj.value="";
                }
                if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
	                obj.value=obj.value.replace(/\.\d{1,}$/,obj.value.substr(obj.value.indexOf('.'),inum));
                }
	        }
        }
        
        
        function Wonkeyup(obj){//用户只能输入正负数与小数
         var inum=document.getElementById("A1PH_Level08").value;
                 
         if(inum.length==5){inum=4;}else{inum=3;}
                  
	        if(isNaN(obj.value) && !/^-$/.test(obj.value)){
		        obj.value="";
	        }
	        if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
		        obj.value=obj.value.replace(/\.\d{1,}$/,obj.value.substr(obj.value.indexOf('.'),inum));
	        }
        }
        
        //------- End 判断输入的是否是证书和小数还有0

        
        function Button2_onclick()
        {
 	        var mymessage = confirm("你确定需要保存吗？或者在检查一遍？");
 	                 
 	         
 	        
 	        if(mymessage==true)
 	        {
 	            return true;        
 	             
 	        
 	        }
 	        else
 	        {
 	            return false;
 	        }
 	        	
        }
        
        function SelectedB(oInput)
        {
        
            var fValue = document.getElementById("B"+oInput).value; 
            
            document.getElementById("B42").value=fValue;
            
            document.getElementById("B84").value=-fValue;  
        
        }
        
        function ResoultFloat(arg1,arg2){
            var t1=0,t2=0,r1,r2;
            try{t1=arg1.toString().split(".")[1].length}catch(e){}
            try{t2=arg2.toString().split(".")[1].length}catch(e){}
            with(Math){
                r1=Number(arg1.toString().replace(".",""));
                r2=Number(arg2.toString().replace(".",""));
                return (r1/r2)*pow(10,t2-t1);
            }
        }
        
        function SetDigitalInputB(oInput)
        {
                
                
                var inum=document.getElementById("A1PH_Level08").value;
                var isnum=2;                 
                
                if(inum.length==5){
                    inum=1;
                    isnum=3;
                }
                else
                {
                inum=0;
                isnum=2;
                }
                
                
                
                if(document.getElementById("B84").value.toString()=="" || document.getElementById("B42").value=="")
                {
                    document.getElementById("B42").value = 2000.00;
                    document.getElementById("B84").value =-2000.00;                
                }
                
                
                var f=oInput-2;
                var j=oInput-1;
                var i=oInput+1;
                var k=oInput+2;
                var m=oInput+3;
                var f_01 = parseFloat(document.getElementById("B"+j).value);
                var f_02=  parseFloat(document.getElementById("B"+oInput).value);
                //var f_x = ((f_01+f_02)/2); 
                var f_d = f_01+f_02;
                var f_x= ResoultFloat(f_d*10000,2)/10000;
                
                document.getElementById("B"+i).value = changeTwoDecimal_y(f_x,inum);
                
                var f_03 = parseFloat(document.getElementById("B"+i).value);
                var f_04 = parseFloat(document.getElementById("B"+f).value);
                
                var f_f = (f_03-f_04)/parseFloat(document.getElementById("B90").value)*100;
                
                document.getElementById("B"+k).value = changeTwoDecimal_y(f_f,isnum);
                
                
                if(oInput==86)
                {
                    var imxs = Math.max(document.getElementById("B46").value,document.getElementById("B40").value,
                    document.getElementById("B34").value,document.getElementById("B28").value,
                    document.getElementById("B22").value,document.getElementById("B16").value,
                    document.getElementById("B10").value,document.getElementById("B4").value,
                    document.getElementById("B52").value,document.getElementById("B58").value,
                    document.getElementById("B64").value,document.getElementById("B70").value,
                    document.getElementById("B76").value,document.getElementById("B82").value,
                    document.getElementById("B88").value);
                    
                    var imins = Math.min(document.getElementById("B46").value,document.getElementById("B40").value,
                    document.getElementById("B34").value,document.getElementById("B28").value,
                    document.getElementById("B22").value,document.getElementById("B16").value,
                    document.getElementById("B10").value,document.getElementById("B4").value,
                    document.getElementById("B52").value,document.getElementById("B58").value,
                    document.getElementById("B64").value,document.getElementById("B70").value,
                    document.getElementById("B76").value,document.getElementById("B82").value,
                    document.getElementById("B88").value);
                    
                    if(Math.abs(imxs)>=Math.abs(imins))
                    {
                    
                        document.getElementById("B47").value=document.getElementById("B41").value=
                        document.getElementById("B35").value=document.getElementById("B29").value=
                        document.getElementById("B23").value=document.getElementById("B17").value=
                        document.getElementById("B11").value=document.getElementById("B5").value=
                        document.getElementById("B53").value=document.getElementById("B59").value=
                        document.getElementById("B65").value=document.getElementById("B71").value=
                        document.getElementById("B77").value=document.getElementById("B83").value=
                        document.getElementById("B89").value=changeTwoDecimal_y(imxs,isnum); 
                    }
                    else
                    {
                        document.getElementById("B47").value=document.getElementById("B41").value=
                        document.getElementById("B35").value=document.getElementById("B29").value=
                        document.getElementById("B23").value=document.getElementById("B17").value=
                        document.getElementById("B11").value=document.getElementById("B5").value=
                        document.getElementById("B53").value=document.getElementById("B59").value=
                        document.getElementById("B65").value=document.getElementById("B71").value=
                        document.getElementById("B77").value=document.getElementById("B83").value=
                        document.getElementById("B89").value=changeTwoDecimal_y(imins,isnum); 
                    
                    }
                }    
            
        }
        
        function SetDigitalInputE(oInput)           
        {
        
//                var inum=document.getElementById("A1PH_Level08").value;
//                 
//                if(inum.length==5){inum=3;}else{inum=2;}

                var s_x = document.getElementById("E"+oInput).value;
                s_x=s_x.toString();
                var pos_decimal = s_x.indexOf('.');
                var inum = s_x.length-pos_decimal-1;
                
            var f_48 = parseFloat(document.getElementById("E0").value);
            var f_49 = parseFloat(document.getElementById("E1").value);
            var f_50 = parseFloat(document.getElementById("E2").value);
            var f_51 = parseFloat(document.getElementById("E3").value);
            var f_52 = parseFloat(document.getElementById("E4").value);
            var f_53 = parseFloat(document.getElementById("E5").value);
            
            var f_01 = f_51-f_48;
            var f_02 = f_52-f_49;
            var f_03 = f_53-f_50;
            
            
                document.getElementById("E6").value = changeTwoDecimal_y(f_01,inum);
                document.getElementById("E7").value = changeTwoDecimal_y(f_02,inum);
                document.getElementById("E8").value = changeTwoDecimal_y(f_03,inum);
        
        }
        
        function SetDigitalInputEE(oInput)
        {
            var inum=document.getElementById("A1PH_Level08").value;
                
                if(inum.length==5){inum=3;}else{inum=2;}
                
            if(oInput==15)
            {
                document.getElementById("K2").value = "0.005"; 
            }
                
                
                var f=oInput-1;
                var j=oInput-2;
                var i=oInput-3;
                var k=oInput-4;
                var m=oInput-5;
                var l=oInput-6;
                
                var z=oInput+1;
                var x=oInput+2;
                var y=oInput+3;
                
                var f_1 = parseFloat(document.getElementById("E"+f).value);
                var f_2 = parseFloat(document.getElementById("E"+j).value);
                var f_3=  parseFloat(document.getElementById("E"+i).value);
                var f_4=  parseFloat(document.getElementById("E"+k).value);
                var f_5=  parseFloat(document.getElementById("E"+m).value);
                var f_6=  parseFloat(document.getElementById("E"+oInput).value);
                
                //var Avg_x =(f_1+f_2+f_3+f_4+f_5+f_6)/6;
                
                var f_d = f_1+f_2+f_3+f_4+f_5+f_6;
                var Avg_x= ResoultFloat(f_d*10000,6)/10000;
                
                document.getElementById("E"+z).value = changeTwoDecimal_y(Avg_x,inum);
                
                var x_1 = parseFloat(document.getElementById("E"+z).value);
                var x_2 = parseFloat(document.getElementById("E"+l).value);
                var x_f = x_1-x_2;
                
                document.getElementById("E"+x).value = changeTwoDecimal_y(x_f,inum);
                
                
                var J_1 =  (f_1-Avg_x)*(f_1-Avg_x);
                var J_2 =  (f_2-Avg_x)*(f_2-Avg_x);
                var J_3 = (f_3-Avg_x)*(f_3-Avg_x);
                var J_4 = (f_4-Avg_x)*(f_4-Avg_x);
                var J_5 = (f_5-Avg_x)*(f_5-Avg_x);
                var J_6 = (f_6-Avg_x)*(f_6-Avg_x);
                
                //var s_7 = (J_1+J_2+J_3+J_4+J_5+J_6)/5;
                
                var s_d = J_1+J_2+J_3+J_4+J_5+J_6;
                var s_7= ResoultFloat(s_d*10000,5)/10000;
                
                var f_f = Math.pow(parseFloat(s_7),0.5);
                
                    
                document.getElementById("E"+y).value = changeTwoDecimal_y(f_f,inum);
        
        
        
        
        }
            
        function SetDigitalInputC(oInput)
        {
                var inum=document.getElementById("A1PH_Level08").value;
                
                if(inum.length==5){inum=3;}else{inum=2;}
                
                var f=oInput-2;
                var j=oInput-1;
                var i=oInput+1;
                var k=oInput+2;
                var m=oInput+3;
                var f_01 = parseFloat(document.getElementById("C"+j).value);
                var f_02=  parseFloat(document.getElementById("C"+oInput).value);
                //var f_x = (f_01+f_02)/2;
                var s_d = f_01+f_02;
                var f_x= ResoultFloat(s_d*10000,2)/10000;
                document.getElementById("C"+i).value = changeTwoDecimal_y(f_x,inum);
                
                var f_y =  parseFloat(document.getElementById("C"+i).value)-parseFloat(document.getElementById("C"+f).value);
                
                document.getElementById("C"+k).value = changeTwoDecimal_y(f_y,inum);
                
                
                if(oInput==80)
                {
                    var imxs = Math.max(document.getElementById("C4").value,document.getElementById("C10").value,
                    document.getElementById("C16").value,document.getElementById("C22").value,
                    document.getElementById("C28").value,document.getElementById("C34").value,document.getElementById("C40").value,
                    document.getElementById("C46").value,document.getElementById("C52").value,document.getElementById("C58").value,
                    document.getElementById("C64").value,document.getElementById("C70").value,document.getElementById("C76").value,
                    document.getElementById("C82").value);
                    
                    var imins = Math.min(document.getElementById("C4").value,document.getElementById("C10").value,
                    document.getElementById("C16").value,document.getElementById("C22").value,
                    document.getElementById("C28").value,document.getElementById("C34").value,document.getElementById("C40").value,
                    document.getElementById("C46").value,document.getElementById("C52").value,document.getElementById("C58").value,
                    document.getElementById("C64").value,document.getElementById("C70").value,document.getElementById("C76").value,
                    document.getElementById("C82").value);
                    
                    if(Math.abs(imxs)>=Math.abs(imins))
                    {
                    
                        document.getElementById("C5").value=document.getElementById("C11").value=
                        document.getElementById("C17").value=document.getElementById("C23").value=
                        document.getElementById("C29").value=document.getElementById("C35").value=
                        document.getElementById("C41").value=document.getElementById("C47").value=
                        document.getElementById("C53").value=document.getElementById("C59").value=
                        document.getElementById("C65").value=document.getElementById("C71").value=
                        document.getElementById("C77").value=document.getElementById("C83").value=changeTwoDecimal_y(imxs,inum);
                    
                    }                      
                    else                      
                    {
                    
                        document.getElementById("C5").value=document.getElementById("C11").value=
                        document.getElementById("C17").value=document.getElementById("C23").value=
                        document.getElementById("C29").value=document.getElementById("C35").value=
                        document.getElementById("C41").value=document.getElementById("C47").value=
                        document.getElementById("C53").value=document.getElementById("C59").value=
                        document.getElementById("C65").value=document.getElementById("C71").value=
                        document.getElementById("C77").value=document.getElementById("C83").value=changeTwoDecimal_y(imins,inum);
                    
                    }
                }
                
                                
            
        }
        
        function SetDigitalInputJ(oInput)
        {
                var inum=document.getElementById("A1PH_Level08").value;
                
                if(inum.length==5){inum=3;}else{inum=2;}
                
                var f=oInput-2;
                var j=oInput-1;
                var i=oInput+1;
                var k=oInput+2;
                var m=oInput+3;
                var f_01 = parseFloat(document.getElementById("J"+j).value);
                var f_02=  parseFloat(document.getElementById("J"+oInput).value);
                //var f_x = (f_01+f_02)/2;
                var s_d = f_01+f_02;
                var f_x= ResoultFloat(s_d*10000,2)/10000;
                document.getElementById("J"+i).value = changeTwoDecimal_y(f_x,inum);
                
                var f_y =  parseFloat(document.getElementById("J"+i).value)-parseFloat(document.getElementById("J"+f).value);
                
                document.getElementById("J"+k).value = changeTwoDecimal_y(f_y,inum);
                
                
                if(oInput==80)
                {
                    var imxs = Math.max(document.getElementById("J4").value,document.getElementById("J10").value,
                    document.getElementById("J16").value,document.getElementById("J22").value,
                    document.getElementById("J28").value,document.getElementById("J34").value,document.getElementById("J40").value,
                    document.getElementById("J46").value,document.getElementById("J52").value,document.getElementById("J58").value,
                    document.getElementById("J64").value,document.getElementById("J70").value,document.getElementById("J76").value,
                    document.getElementById("J82").value);
                    
                    var imins = Math.min(document.getElementById("J4").value,document.getElementById("J10").value,
                    document.getElementById("J16").value,document.getElementById("J22").value,
                    document.getElementById("J28").value,document.getElementById("J34").value,document.getElementById("J40").value,
                    document.getElementById("J46").value,document.getElementById("J52").value,document.getElementById("J58").value,
                    document.getElementById("J64").value,document.getElementById("J70").value,document.getElementById("J76").value,
                    document.getElementById("J82").value);
                    
                    
                    if(Math.abs(imxs)>=Math.abs(imins))
                    {
                    
                        document.getElementById("J5").value=document.getElementById("J11").value=
                        document.getElementById("J17").value=document.getElementById("J23").value=
                        document.getElementById("J29").value=document.getElementById("J35").value=
                        document.getElementById("J41").value=document.getElementById("J47").value=
                        document.getElementById("J53").value=document.getElementById("J59").value=
                        document.getElementById("J65").value=document.getElementById("J71").value=
                        document.getElementById("J77").value=document.getElementById("J83").value=changeTwoDecimal_y(imxs,inum);
                    
                    }                      
                    else                      
                    {
                    
                        document.getElementById("J5").value=document.getElementById("J11").value=
                        document.getElementById("J17").value=document.getElementById("J23").value=
                        document.getElementById("J29").value=document.getElementById("J35").value=
                        document.getElementById("J41").value=document.getElementById("J47").value=
                        document.getElementById("J53").value=document.getElementById("J59").value=
                        document.getElementById("J65").value=document.getElementById("J71").value=
                        document.getElementById("J77").value=document.getElementById("J83").value=changeTwoDecimal_y(imins,inum);
                    
                    }
                    
                    
                    
                }
                
                                
            
        }
        
        function SetDigitalInputCC(oInput)
        {
                
                var inum=document.getElementById("A1PH_Level08").value;
                
                if(inum.length==5){inum=3;}else{inum=2;}
                
                
                var f=oInput-1;
                var j=oInput-2;
                var i=oInput-3;
                var k=oInput-4;
                var m=oInput-5;
                var n=oInput+1;
                var f_1 = parseFloat(document.getElementById("C"+f).value);
                var f_2 = parseFloat(document.getElementById("C"+j).value);
                var f_3=  parseFloat(document.getElementById("C"+i).value);
                var f_4=  parseFloat(document.getElementById("C"+k).value);
                var f_5=  parseFloat(document.getElementById("C"+m).value);
                var f_6=  parseFloat(document.getElementById("C"+oInput).value);
                
                // var Avg_x =(f_1+f_2+f_3+f_4+f_5+f_6)/6;
                
                var s_d = f_1+f_2+f_3+f_4+f_5+f_6;
                var Avg_x= ResoultFloat(s_d*10000,6)/10000;
                
                var J_1 =  (f_1-Avg_x)*(f_1-Avg_x);
                var J_2 =  (f_2-Avg_x)*(f_2-Avg_x);
                var J_3 = (f_3-Avg_x)*(f_3-Avg_x);
                var J_4 = (f_4-Avg_x)*(f_4-Avg_x);
                var J_5 = (f_5-Avg_x)*(f_5-Avg_x);
                var J_6 = (f_6-Avg_x)*(f_6-Avg_x);
                
                var s_7 = (J_1+J_2+J_3+J_4+J_5+J_6)/5;
                
                var f_f = Math.pow(parseFloat(s_7),0.5);
                
                    
                document.getElementById("C"+n).value = changeTwoDecimal_y(f_f,inum);
                                
                // 新增功能：计算C_max的值
                updateValue([92, 101], "C", "C_max");
        }
            
        function SetDigitalInputD(oInput)
        {
        
        
//                 var inum=document.getElementById("A1PH_Level08").value;
//                 
//                 if(inum.length==5){inum=3;}else{inum=2;}

                
                
                var s_x = document.getElementById("D"+oInput).value;
                s_x=s_x.toString();
                var pos_decimal = s_x.indexOf('.');
                var inum = s_x.length-pos_decimal-1;
                                
                var i=oInput-2;
                var k=oInput-1;
                var m=oInput+1;
                var n=oInput+2;
                
                var f_1 = parseFloat(document.getElementById("D"+oInput).value);
                var f_2 = parseFloat(document.getElementById("D"+k).value);
                var f_3=  parseFloat(document.getElementById("D"+i).value);
                
                // var Avg_x =(f_1+f_2+f_3)/3;
                
                var s_d = f_1+f_2+f_3;
                var Avg_x= ResoultFloat(s_d*10000,3)/10000;
                
                document.getElementById("D"+m).value = changeTwoDecimal_y(Avg_x,inum);
                
                if(oInput==11)
                {
                
                var H_1 = parseFloat(document.getElementById("D5").value);
                var H_2 = parseFloat(document.getElementById("D12").value);
                
                var H_3 = (Math.abs(H_1-H_2)/1000000000)*0.001;
                
                if(H_3!=0)
                {
                    H_3=H_3.toExponential(); 
                    var sValue = parseFloat(H_3.toString().substring(0,H_3.toString().length-4)).toFixed(3)+''+H_3.toString().substring(H_3.toString().length-4,H_3.toString().length);
                    
                    document.getElementById("D6").value=sValue;
                    document.getElementById("D13").value=sValue;         
                }
                else
                {
                    
                    document.getElementById("D6").value=H_3;
                    document.getElementById("D13").value=H_3;
                }
                }
                
                if(oInput==25)
                {
                
                var o_1 = parseFloat(document.getElementById("D19").value);
                var o_2 = parseFloat(document.getElementById("D26").value);
                
                var o_3 = (Math.abs(o_1-o_2)/1000000000)*0.001;
                
                //document.getElementById("D20").value=document.getElementById("D27").value=o_3;
                
                if(o_3!=0)
                {
                    o_3=o_3.toExponential(); 
                    var sValue = parseFloat(o_3.toString().substring(0,o_3.toString().length-4)).toFixed(3)+''+o_3.toString().substring(o_3.toString().length-4,o_3.toString().length);
                    
                    document.getElementById("D20").value=sValue;
                    document.getElementById("D27").value=sValue;         
                }
                else
                {
                    
                    document.getElementById("D20").value=o_3;
                    document.getElementById("D27").value=o_3;
                }
                
                }
        
        
        }
             
        function SetDigitalInputF(oInput)
        {
                var inum=document.getElementById("A1PH_Level08").value;
                if(inum==0)
                {
                    alert("请选择仪器级别，确定输入小数位(0.01/0.001)");
                    return false;
                }
                else 
                {if(inum.length==5){inum=3;}else{inum=2;}}
                
                
                var f=oInput-2;
                var j=oInput-1;
                var i=oInput+1;
                
                
                var f_01 = parseFloat(document.getElementById("F"+j).value);
                
                var f_02=  parseFloat(document.getElementById("F"+oInput).value);  
                
                var f_03=  parseFloat(document.getElementById("F"+f).value);    
                
                // var f_x = (f_03+f_02+f_01)/3; 
                
                var s_d = f_03+f_02+f_01;
                var f_x= ResoultFloat(s_d*10000,3)/10000;
                
                document.getElementById("F"+i).value = changeTwoDecimal_y(f_x,inum);
                
                
                if(oInput==11)
                {
                var f_5= parseFloat(document.getElementById("F5").value);
                var f_12= parseFloat(document.getElementById("F12").value);
                
                var f_f_1 = Math.abs(f_5/(f_12-f_5))*1000000000;
                if(f_f_1!=0)
                {
                    f_f_1=f_f_1.toExponential(); 
                    var sValue = parseFloat(f_f_1.toString().substring(0,f_f_1.toString().length-4)).toFixed(3)+''+f_f_1.toString().substring(f_f_1.toString().length-4,f_f_1.toString().length);
                    
                    document.getElementById("F6").value=sValue;
                    document.getElementById("F13").value=sValue;         
                }
                else
                {
                    
                    document.getElementById("F6").value=f_f_1;
                    document.getElementById("F13").value=f_f_1;
                }
                
                
                //  document.getElementById("F6").value=document.getElementById("F13").value=changeTwoDecimal_y(f_f_1,inum);
                } 
                
                if(oInput==25)
                {
                var f_19= parseFloat(document.getElementById("F19").value);
                var f_26= parseFloat(document.getElementById("F26").value);
                
                var f_f_2 = Math.abs(f_19/(f_26-f_19))*1000000000;
                
                if(f_f_2!=0)
                {
                    f_f_2=f_f_2.toExponential(); 
                    var sValue = parseFloat(f_f_2.toString().substring(0,f_f_2.toString().length-4)).toFixed(3)+''+f_f_2.toString().substring(f_f_2.toString().length-4,f_f_2.toString().length);
                    
                    document.getElementById("F20").value=sValue;
                    document.getElementById("F27").value=sValue;         
                }
                else
                {
                    
                    document.getElementById("F20").value=f_f_2;
                    document.getElementById("F27").value=f_f_2;
                }
                
                
                //document.getElementById("F20").value=document.getElementById("F27").value=changeTwoDecimal_y(f_f_2,inum);
                } 
                
                if(oInput==39)
                {
                var f_33= parseFloat(document.getElementById("F33").value);
                var f_40= parseFloat(document.getElementById("F40").value);
                
                var f_f_3 = Math.abs(f_33/(f_40-f_33))*1000000000;
                
                if(f_f_3!=0)
                {
                    f_f_3=f_f_3.toExponential(); 
                    var sValue = parseFloat(f_f_3.toString().substring(0,f_f_3.toString().length-4)).toFixed(3)+''+f_f_3.toString().substring(f_f_3.toString().length-4,f_f_3.toString().length);
                    
                    document.getElementById("F41").value=sValue;
                    document.getElementById("F34").value=sValue;         
                }
                else
                {
                    
                    document.getElementById("F41").value=f_f_3;
                    document.getElementById("F34").value=f_f_3;
                }
                
                //document.getElementById("F34").value=document.getElementById("F41").value=changeTwoDecimal_y(f_f_3,inum);
                } 
                
                // 新增功能：计算F_max的值
                updateValue([6, 20], "F", "F_max");
        }
            
        function SetDigitalInputH(oInput)
        {
                
                var inum=document.getElementById("A1PH_Level08").value;
                
                if(inum.length==5){inum=3;}else{inum=2;}                 
                
                var f=oInput-2;
                var j=oInput-1;
                var i=oInput+1;
                var m=oInput+2;
                
                
                var f_01 = parseFloat(document.getElementById("H"+j).value);
                
                var f_02=  parseFloat(document.getElementById("H"+oInput).value);  
                
                var s_d = f_02+f_01;
                var f_x= ResoultFloat(s_d*10000,2)/10000;
                
                // var f_x = (f_02+f_01)/3; 
                
                document.getElementById("H"+i).value = changeTwoDecimal_y(f_x,inum);
                
                var f_03=  parseFloat(document.getElementById("H"+f).value);
                var f_04=  parseFloat(document.getElementById("H"+i).value);
                
                //var f_f = (f_04-f_03)/2 ; 
                var f_d = f_04-f_03;
                var f_f= ResoultFloat(f_d*10000,2)/10000;
                document.getElementById("H"+m).value = changeTwoDecimal_y(f_f,inum);
                
                // 新增功能：计算H_max的值
                updateValue([5, 11, 17], "H", "H_max1");
                updateValue([23, 29, 35], "H", "H_max2");
            
        }
           
        function changeTwoDecimal_f(x)
        {
            var f_x = parseFloat(x);
            if (isNaN(f_x))
            {
                alert('function:changeTwoDecimal->parameter error');
                return false;
            }
            f_x = Math.round(f_x*100)/100;
            var s_x = f_x.toString();
            var pos_decimal = s_x.indexOf('.');
            if (pos_decimal < 0)
            {
                pos_decimal = s_x.length;
                s_x += '.';
            }
            while (s_x.length <= pos_decimal + 3)
            {
                s_x += '0';
            }
            return s_x;
        }
            
        function changeTwoDecimal_y(s_x,inum)
        {  
             s_x = s_x.toFixed(inum + 1);
            if (isNaN(s_x))
            {
                alert('function:changeTwoDecimal->parameter error');
                return false;
            }
            
            s_x=s_x.toString();
            
           
            
            var pdecimal = s_x.indexOf('.');

            if (pdecimal < 0)
            {
                pdecimal = s_x.length;
                s_x += '.';
            }            
               
            while (s_x.length < parseInt(parseInt(pdecimal)+parseInt(inum+3)))
            {
                s_x += '0';
            }
            
            
            
            var inums = inum+s_x.indexOf('.');

            
            var iReturnValue = "";

            if(s_x.length>(parseInt(inums)+3))
            {
                s_x = s_x.substring(0,(parseInt(inums)+3));
            }
            
           
            if(s_x.length==(parseInt(inums)+3))
            {  
                                 
                              
               var s_x_l = parseInt(s_x.substring(s_x.length-1,s_x.length));
               var s_x_S = parseInt(s_x.substring(s_x.length-2,s_x.length-1));
               var s_x_T = parseInt(s_x.substring(s_x.length-3,s_x.length-2));
               
            
                
                if(s_x_S!=5)
                {
                    return iReturnValue= parseFloat(s_x).toFixed(inum); 

                }
                else if(s_x_S==5 && s_x_l!=0)
                {
                    return iReturnValue= parseFloat(s_x).toFixed(inum);
                    
                }
                else if(s_x_S==5 && s_x_l==0)
                {
                    if(s_x_T%2==0)
                    { 
                        return iReturnValue=parseFloat(s_x.substring(0,parseInt(inums+1))).toFixed(inum);
                         
                    }
                    else
                    {
                         
                         if(inum==1)
                          {
                             
                            var iValue = parseFloat(s_x.substring(0,parseInt(inums+1)));
                            
                            if(parseFloat(s_x)>=0)
                            {
                             
                                 return iReturnValue= parseFloat(iValue+0.1).toFixed(inum);
                            }
                            else
                            {
                            
                                return iReturnValue= parseFloat(iValue-0.1).toFixed(inum);
                            }
                             
                             
                          }
                          else if(inum==2 ||inum==3 )
                          {
                            if(parseFloat(s_x)>=0)
                            {
                               return iReturnValue=parseFloat(parseFloat(s_x.substring(0,parseInt(inums+1)))+parseFloat(inum==2?0.01:0.001)).toFixed(inum);
                            }
                            else
                            {
                            
                                return iReturnValue=parseFloat(parseFloat(s_x.substring(0,parseInt(inums+1)))+parseFloat(inum==2?(-0.01):(-0.001))).toFixed(inum);
                            }
                             
                          }
                          else
                          {
                           
                             return iReturnValue=parseFloat(s_x.substring(0,parseInt(inums+1))).toFixed(inum);
                             

                          }
                    }

                }
               
            }

           

          

        }
            
        function Setnum(oInput)
        {
            var f_x = parseFloat(document.getElementById("A1PH_Dy10").value);
            
            document.getElementById("C49").value=f_x;
            document.getElementById("C98").value=-f_x;
            document.getElementById("C106").value=f_x;              
            
        }
            
        // 新增函数：计算绝对值最大的正值
        function updateValue(fieldIndexes, fieldPrefix, targetFieldId) {
            var values = [];
            
            // 收集所有非空字段的值
            for (var idx = 0; idx < fieldIndexes.length; idx++) {
                var fieldId = fieldPrefix + fieldIndexes[idx];
                var fieldElement = document.getElementById(fieldId);
                
                if (fieldElement && fieldElement.value !== "" && fieldElement.value !== "/") {
                    values.push(parseFloat(fieldElement.value));
                }
            }
            
            // 如果有值，计算绝对值最大的值
            if (values.length > 0) {
                var maxAbsValue = values[0];
                var maxAbs = Math.abs(values[0]);
                
                for (var i = 1; i < values.length; i++) {
                    var absValue = Math.abs(values[i]);
                    // 如果找到更大的绝对值，或者绝对值相等但当前是正值，则更新
                    if (absValue > maxAbs || (absValue === maxAbs && values[i] > 0 && maxAbsValue < 0)) {
                        maxAbsValue = values[i];
                        maxAbs = absValue;
                    }
                }
                
                // 设置目标字段的值
                var targetElement = document.getElementById(targetFieldId);
                if (targetElement) {
                    // 如果目标字段是F_max，则使用科学计数法显示
                    if (targetFieldId === "F_max") {
                        if (maxAbsValue != 0) {
                            var sValue = maxAbsValue.toExponential(); 
                            sValue = parseFloat(sValue.toString().substring(0,sValue.toString().length-4)).toFixed(3)+''+sValue.toString().substring(sValue.toString().length-4,sValue.toString().length);
                            targetElement.value = sValue;
                        } else {
                            targetElement.value = maxAbsValue;
                        }
                    } else {
                        // 其他字段使用原来的处理方式
                        var inum = document.getElementById("A1PH_Level08").value;
                        var decimalPlaces = (inum.length == 5) ? 3 : 2;
                        targetElement.value = changeTwoDecimal_y(maxAbsValue, decimalPlaces);
                    }
                }
            }
        }

            